1 REM BUDGET PLANNER, C.B.SILBERGLEITH COMPUTE'S GAZ. 12/83 2 : 3 REM MODIFIED BY M.J.KOZAKIEWICZ (6/84) TO INCLUDE THE FOLLOWING ITEMS: 4 REM * DISK ERROR CHECKING 5 REM * WEEK DUE FIELD, AND SORTING BY WEEK DUE 6 REM * SCREEN DUMP TO PRINTER WHEN '\' PRESSED (ROUTINE @ 49152) 7 REM * DISK DIRECTORY OPTION AVAILABLE FROM 'LOAD/MERGE' AND 'SAVE' OPTIONS 8 REM ** NOTE: SCRN DUMP AND DISK DIRECTORY OPTIONS ARE LOCATED IN ML ROUTINES 9 REM ** LOADED BY 'HOUSE BUDGET' PROGRAM WHICH ALSO LOADS AND RUNS THIS PROG. 10 REM DEFINE VARIABLES 20 SZ=100:I=-19:POKE53281,12:POKE53280,0:PRINT"[144]":POKE53272,23 30 R$=CHR$(13):TA=0 40 DIMA$(SZ),AE(SZ),AW(SZ) 50 DEFFNRN(X)=INT(X*100+.5)/100 200 REM MAIN ROUTINE 210 GOSUB 6000 220 Z$="":GETZ$:IFZ$=""THENGOTO220 230 IFZ$=CHR$(133) THENI=I+20:GOSUB1000 235 IFZ$=CHR$(134) THENGOSUB3000 240 IFZ$=CHR$(135) THENGOSUB5000 245 IFZ$=CHR$(136) THENGOSUB7000 250 IFZ$=CHR$(137) THENGOSUB2000 255 IFZ$=CHR$(138) THENGOSUB4000:GOTO210 260 IFZ$=CHR$(139) THENGOSUB6000 265 IFZ$=CHR$(140) THENGOSUB8000 270 IFZ$=CHR$(17) THENI=I-1:GOSUB1000 275 IFZ$=CHR$(145)THENI=I+1:GOSUB1000 299 GOTO220 300 REM ACCUM TOTALS 310 TA=0 320 FOR J=1TOMX 330 TA=TA+AE(J) 340 NEXTJ 350 RETURN 400 REM LOAD FILES 410 INPUT"FILE NAME";F$ 420 IFF$="*END"THENGOSUB6000:RETURN 450 CLOSE1:CLOSE15:OPEN15,8,15:OPEN1,8,0,F$ 452 GOSUB9000:IFE1$<>"00"THEN GOSUB9500:GOTO495 455 PRINT" FOUND[146][144] ";F$ 460 INPUT#1,MX 465 GOSUB9000:IFE1$<>"00"THEN GOSUB9500:GOTO 495 470 FORJ=1TOMX 480 INPUT#1,Y,A$(J),AE(J),AW(J) 485 GOSUB9000:IFE1$<>"00"THEN GOSUB9500:GOTO 495 490 NEXTJ 495 CLOSE1:CLOSE15 499 RETURN 500 REM SORT BY WEEK 505 IFMX=1THENGOTO599 510 PRINT" SORTING[146]" 520 FORJ=1TOMX-1 530 FORK=J+1TOMX 540 IFAW(K)>AW(J)THENGOTO590 550 SM$=A$(K):SM=AE(K):SW=AW(K) 560 A$(K)=A$(J):AE(K)=AE(J):AW(K)=AW(J) 570 A$(J)=SM$:AE(J)=SM:AW(J)=SW 590 NEXTK 595 NEXTJ 599 RETURN 1000 REM DISPLAY 1010 IF(I<1)OR(I>MX)THENI=1 1020 PRINT"[147] #[146]"TAB(5)"EXPENSES[146]"TAB(16)"AMT[146]"TAB(29)"WK DUE[144][146]" 1030 FORJ=ITOI+19 1040 IFJ>MXTHENPRINT"[160]":GOTO1080 1050 PR$=STR$(AE(J)+.001):PR$=MID$(PR$,2,(LEN(PR$)-2)) 1060 IFAE(J)=0THENPR$="0.00" 1065 J$=MID$(STR$(J),2) 1070 PRINTTAB(3-LEN(J$))J$;TAB(4)A$(J)TAB(21-LEN(PR$))PR$;TAB(30)AW(J) 1080 NEXTJ 1090 TA$=STR$(TA+.001) 1100 TA$=LEFT$(TA$,LEN(TA$)-1) 1110 IFTA=0THENTA$="0.00" 1120 PRINT"TOTAL[144][146] "TA$,"F6[146][144]-OPTIONS SCREEN" 1999 RETURN 2000 REM ADD NEW 2010 R=MX+1:N$="":E1$="" 2020 PRINT"[147]ADD NEW EXPENSES" 2030 PRINT"ITEM #";R 2040 INPUT"ITEM NAME *END[157][157][157][157][157][157]";N$ 2050 IFN$="*END"THENGOTO2999 2055 IFLEN(N$)>10THEN N$=LEFT$(N$,10) 2060 A$(R)=N$ 2070 INPUT"ITEM AMT ";E1$ 2080 IFE1$="*END"THENGOTO2999 2085 IFVAL(E1$)=0THENAE(R)=0:GOTO2100 2090 AE(R)=FNRN(VAL(E1$)) 2095 IFAE(R)>9999.99THENAE(R)=9999.99 2096 INPUT"WEEK DUE *END[157][157][157][157][157][157]";W$ 2097 IFW$="*END"THENGOTO2999 2098 IFVAL(W$)>5ORVAL(W$)<0 THEN 2096 2099 AW(R)=VAL(W$) 2100 MX=MX+1 2110 GOTO2010 2200 MX=MX+1 2999 GOSUB500:GOSUB300:GOSUB6000:RETURN 3000 REM UPDATE 3010 PRINT"[147]";TAB(10)"EXPENSE";" ";"UPDATE[146][144]" 3020 INPUT"ITEM # *END[157][157][157][157][157][157]";P1$ 3025 IFP1$="*END"THENGOTO3999 3026 IF(VAL(P1$)=0)OR(VAL(P1$)<1)THENPRINT"INPUT ERROR[146][144]":GOTO3020 3027 P=INT(VAL(P1$)) 3030 N$="":E1$="" 3040 IFP>SZTHENPRINT"MAX EXCEEDED":P=SZ:MX=P 3050 IFP>MXTHENMX=P 3060 PR$=STR$(AE(P)+.001):PR$=MID$(PR$,2,(LEN(PR$)-2)) 3065 IFAE(P)=0THENPR$="0.00" 3070 PRINTP;TAB(4)A$(P)TAB(21-LEN(PR$))PR$TAB(30)AW(P) 3080 INPUT"ITEM NAME";N$ 3090 IFN$="*END"THENGOTO3999 3100 IFN$<>""THENA$(P)=N$ 3105 IFLEN(A$(P))>10THENA$(P)=LEFT$(A$(P),10) 3110 INPUT"AMT ";E1$ 3120 IFE1$="*END"THENGOTO3999 3125 IFE1$=""GOTO3160 3130 IF(VAL(E1$)=0)AND(E1$<>"0")THENPRINT"[156]INPUT ERROR[146][144]":GOTO3110 3135 IFVAL(E1$)=0THENAE(P)=0:GOTO3800 3140 AE(P)=FNRN(VAL(E1$)) 3150 IFAE(P)>9999.99THENAE(P)=9999.99 3160 INPUT"WEEK ";E1$ 3165 IFE1$="*END"THENGOTO3999 3170 IFE1$=""GOTO3010 3175 AW(P)=VAL(E1$) 3800 GOTO3010 3999 GOSUB500:GOSUB300:GOSUB6000:RETURN 4000 REM SAVE FILE 4010 PRINT"[147] SAVE EXPENSE LIST" 4020 INPUT"FILE NAME OR $ (DISK DIR)";F$ 4030 IFF$="*END"THENGOTO4999 4035 IFF$="$"THENGOSUB9600:SYS49329:GOTO4020 4050 CLOSE1:CLOSE15:OPEN15,8,15:OPEN1,8,1,F$ 4055 GOSUB9000:IFE1$<>"00"THENGOSUB9500:GOTO4999 4060 PRINT#1,MX:GOSUB9000:IF E1$<>"00"THEN GOSUB9500:GOTO4999 4070 FORJ=1TOMX 4080 PRINT#1,J;R$;A$(J)R$;AE(J);R$;AW(J);R$ 4085 GOSUB9000:IFE1$<>"00"THENGOSUB9500:GOTO4999 4090 NEXTJ 4100 CLOSE1:CLOSE15 4999 RETURN 5000 REM DELETE 5005 DT=0:TM=0 5010 PRINT"[147] DELETE" 5020 S1$="" 5030 INPUT"START AT *END[157][157][157][157][157][157]";S1$ 5040 IFS1$="*END"THENGOTO5900 5050 DS=INT(VAL(S1$)) 5060 S1$="" 5070 IFDS=0THENPRINT"INPUT ERROR[146][144]":GOTO5020 5080 S1$="" 5090 INPUT"END AT";S1$ 5100 IFS1$="*END"THENGOTO5900 5110 IFS1$=""ORS1$="0"THENDE=0:GOTO5200 5120 DE=INT(VAL(S1$)) 5125 IFDE>MXTHENDE=MX 5130 IFDE=>DSTHENGOTO5200 5135 PRINT"0 OR NUMBER GREATER" 5140 PRINT"THAN[146][144]";DE;"REQUIRED[144]" 5150 GOTO5080 5200 IFDE=0THENDE=DS 5205 TM=DE-DS+1 5207 DT=DT+TM 5210 FORJ=DSTODE 5220 A$(J)="[160][160][160][160][160][160][160][160][160]":AE(J)=0:AW(J)=9 5230 NEXTJ 5240 GOTO5010 5900 GOSUB500 5910 MX=MX-DT 5999 GOSUB300:GOSUB6000:RETURN 6000 REM OPTIONS MENU 6010 PRINT"[147][144]OPTIONS:" 6020 PRINTTAB(8)"========" 6030 PRINTTAB(8)"F1[146][144]-DISPLAY EXPENSES" 6040 PRINTTAB(8)"F2[146][144]-ADD NEW EXPENSES" 6050 PRINTTAB(8)"F3[146][144]-UPDATE EXPENSE LIST" 6060 PRINTTAB(8)"F4[146][144]-SAVE EXPENSE LIST" 6070 PRINTTAB(8)"F5[146][144]-DELETE FROM LIST" 6080 PRINTTAB(8)"F6[146][144]-OPTIONS SCREEN" 6090 PRINTTAB(8)"F7[146][144]-LOAD/MERGE FILES" 6100 PRINTTAB(8)"F8[146][144]-END" 6105 PRINTTAB(9)"\[146][144]-SCREEN DUMP TO PRINTER" 6110 PRINTTAB(8)"NOTE[146][144]-ENTER '*END' TO EXIT ANY" 6120 PRINTTAB(13)"FUNCTION" 6999 RETURN 7000 REM LOAD/MERGE 7010 PRINT"[147] LOAD/MERGE[146]" 7020 PRINT" [144]EXPENSE FILES" 7030 INPUT"LOAD, MERGE, OR DISK DIR (L/M/$) L[157][157][157]";AN$ 7035 IFAN$="$"THENGOSUB9600:SYS49329:GOTO7030 7040 IF AN$="L"THENMX=0:GOSUB400:GOTO7999 7050 IF AN$="*END"THENGOSUB6000:RETURN 7060 IF AN$<>"M"THENGOTO7030 7070 PRINT"MERGE" 7080 INPUT"FILE NAME";F$ 7090 IFF$="*END"THENGOSUB6000:RETURN 7120 CLOSE1:CLOSE15:OPEN15,8,15:OPEN1,8,0,F$ 7130 INPUT#1,T1:GOSUB9000:IFE1$<>"00"THEN GOTO 9500 7140 FORT2=1TOT1 7150 INPUT#1,Y,T3$,T4,TW:GOSUB9000:IF E1$<>"00" THEN GOTO 9500 7160 FORJ=1TOMX 7170 IFA$(J)=T3$THENAE(J)=INT(((AE(J)+T4)/2)*100)/100:T3$="" 7180 NEXTJ 7190 IFT3$<>""THENMX=MX+1:A$(MX)=T3$:AE(MX)=T4:AW(MX)=TW 7200 NEXT 7210 CLOSE 1:CLOSE 15 7999 GOSUB500:GOSUB300:GOSUB6000:RETURN 8000 REM END OF JOB 8010 PRINT"[147] END OF PROGRAM[144][146]" 8020 PRINT"WOULD YOU LIKE TO SAVE (Y/N) ";:INPUT"Y[157][157][157]";AN$ 8030 IF AN$="*END"THENGOSUB6000:RETURN 8040 IF AN$="N"THEN GOTO8060 8050 GOSUB4000 8060 PRINT"[147] THAT'S ALL, FOLKS!" 8070 PRINT" END" 8080 END 9000 INPUT#15,E1$,E2$,E3$,E4$:IFE1$="00"THEN RETURN 9010 PRINT" ** ERROR **":PRINT" DISK ERROR ";E1$;": ";E2$;".":RETURN 9500 PRINT" PRESS RETURN[144][146]":CLOSE1:CLOSE15 9510 GETZX$: IFZX$=""THEN9510 9520 RETURN 9600 PRINT" INSERT DISK IN DRIVE[146][144]":GOSUB9500:RETURN